package ro.dandanciu.webgallery.ui.general;

import java.util.List;

import org.apache.log4j.Logger;

import ro.dandanciu.webgallery.services.AdvertiseServices;
import ro.dandanciu.webgallery.domainmodel.Advert;


public class HomeAction extends  WebGalleryAction{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3628637054637146036L;


	private AdvertiseServices advertiseServices;
	
	private List<Advert> adverts;
	
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(HomeAction.class);

	
	public String execute() throws Exception {
		if (logger.isDebugEnabled()) {
			logger.debug("execute() - start");
		}
		
		adverts = advertiseServices.getForUser(getSessionUser());
		
		// TODO Auto-generated method stub
		String returnString = super.execute();
		if (logger.isDebugEnabled()) {
			logger.debug("execute() - end");
		}
		return returnString;
	}

	public AdvertiseServices getAdvertiseServices() {
		return advertiseServices;
	}

	public void setAdvertiseServices(AdvertiseServices advertiseServices) {
		this.advertiseServices = advertiseServices;
	}
	
	public List<Advert> getAdverts() {
		return adverts;
	}

}
